package com.yihengyi.javaconcurrent.atomics;

import org.openjdk.jcstress.annotations.*;
import org.openjdk.jcstress.infra.results.II_Result;

/**
 * simple add .
 *
 * @author liucheng
 * @since 0.1 2021-05-23 2:06 PM
 **/
@Outcome(id="1, 1", expect = Expect.ACCEPTABLE_INTERESTING, desc = "两个线程结果都是1：原子性")
@State
public class SimpleAdd {
    int v;

    @Actor
    public void actor1(II_Result r) {
        r.r1 = ++v;
    }

    @Actor
    public void actor2(II_Result r) {
        r.r2 = ++v;
    }
}
